.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "COREDNS\-REVERSE" "7" "May 2018" "CoreDNS" "CoreDNS plugins"
.
.SH "NAME"
\fIreverse\fR \- allows for dynamic responses to PTR and the related A/AAAA requests\.
.
.SH "DESCRIPTION"
If a request matches a regular expression (see Template Syntax below) this plugin will generate a response\. This is only done for "address" records (PTR, A and AAAA)\.
.
.SH "SYNTAX"
.
.nf

reverse NETWORK\.\.\. {
    hostname TEMPLATE
    [ttl TTL]
    [fallthrough [ZONES\.\.\.]]
    [wildcard]
.
.fi
.
.IP "\(bu" 4
\fBNETWORK\fR one or more CIDR formatted networks to respond on\.
.
.IP "\(bu" 4
\fBhostname\fR injects the IP and zone to a template for the hostname\. Defaults to "ip\-{IP}\.{zone[1]}"\. See below for template\.
.
.IP "\(bu" 4
\fBttl\fR defaults to 60
.
.IP "\(bu" 4
\fBfallthrough\fR if zone matches and no record can be generated, pass request to the next plugin\. If \fB[ZONES\.\.\.]\fR is omitted, then fallthrough happens for all zones for which the plugin is authoritative\. If specific zones are listed (for example \fBin\-addr\.arpa\fR and \fBip6\.arpa\fR), then only queries for those zones will be subject to fallthrough\.
.
.IP "\(bu" 4
\fBwildcard\fR allows matches to catch all subdomains as well\.
.
.IP "" 0
.
.SS "TEMPLATE SYNTAX"
The template for the hostname is used for generating the PTR for a reverse lookup and matching the forward lookup back to an IP\.
.
.P
The \fB{ip}\fR symbol is \fBrequired\fR to make reverse work\. For IPv4 lookups the IP is directly extracted With IPv6 lookups the ":" is removed, and any zero ranged are expanded, e\.g\., "ffff::ffff" results in "ffff000000000000000000000000ffff"
.
.P
The \fB{zone[i]}\fR symbol is \fBoptional\fR and can be replaced by a fixed (zone) string\. The zone will be matched by the zones listed in \fIthis\fR configuration stanza\. \fBi\fR needs to be replaced with the index of the configured listener zones, starting with 1\.
.
.SH "EXAMPLES"
.
.nf

arpa compute\.internal {
    # proxy unmatched requests
    proxy \. 8\.8\.8\.8

    # answer requests for IPs in this network
    # PTR 1\.0\.32\.10\.in\-addr\.arpa\. 3600 ip\-10\.0\.32\.1\.compute\.internal\.
    # A ip\-10\.0\.32\.1\.compute\.internal\. 3600 10\.0\.32\.1
    # v6 is also possible
    # PTR 1\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.0\.1\.0\.d\.f\.ip6\.arpa\. 3600 ip\-fd010000000000000000000000000001\.compute\.internal\.
    # AAAA ip\-fd010000000000000000000000000001\.compute\.internal\. 3600 fd01::1
    reverse 10\.32\.0\.0/16 fd01::/16 {
        # template of the ip injection to hostname, zone resolved to compute\.internal\.
        hostname ip\-{ip}\.{zone[2]}

        ttl 3600

        # Forward unanswered or unmatched requests to proxy
        # without this flag, requesting A/AAAA records on compute\.internal\. will end here\.
        fallthrough
    }
}
.
.fi
.
.IP "" 4
.
.nf

32\.10\.in\-addr\.arpa\.arpa arpa\.company\.org {

    reverse 10\.32\.0\.0/16 {
        # template of the ip injection to hostname, zone resolved to arpa\.company\.org\.
        hostname "ip\-{ip}\.v4\.{zone[2]}"

        ttl 3600

        # fallthrough is not required, v4\.arpa\.company\.org\. will be only answered here
    }

    # cidr closer to the ip wins, so we can overwrite the "default"
    reverse 10\.32\.2\.0/24 {
        # its also possible to set fix domain suffix
        hostname ip\-{ip}\.fix\.arpa\.company\.org\.

        ttl 3600
    }
}
.
.fi
.
.IP "" 0

